define(function(require, exports, modules) {
	var $ = require('jquery');
	require("jqueryMobile");
	require("jquery.cookie");
	require("jqueryMore");
	require("swiper");
	var iScroll = require('iscroll');
	var Common = require('Common');
	var Common3 = require('Common3');

	var shareHouse_storage = window.localStorage;
	window.ShareHouse = {
		scroll: null,
		picsScroll: null, //户型图滚动
		showScroll: null, //户型图大图滚动
		imgshowScroll: null, //实景图滚动
		vrScroll: null,
		areaId: "",
		areaName: "",
		houseId: "",
		from: "",
		houseName: "",
		canMore: true,
		type: "", //是否日志1，日志，2投诉，3表示物业商家详情
		topicId: "",
		userId: "",
		topSpeed: 3000, //单张图片不自动滚动，0为不滚动
		isExternal: false, //单张图片不可滑动，false为可以滑动
		address: '',
		address_x: 0, //119.95861,//地图经纬度
		address_y: 0, //31.712731,//地图经纬度
		needIdCard: 0, //推荐时是否需要填身份证号码,0:不需要，1:需要
		showMask: function(theme, msg) {
			$.mobile.showPageLoadingMsg(theme, msg);
			$(".mask_div").css("display", "block");
		},
		hideMask: function(theme, msg) {
			$.mobile.hidePageLoadingMsg(theme, msg);
			$(".mask_div").css("display", "none");
		},
		initScroll: function() {

			if(!ShareHouse.scroll) {
				ShareHouse.scroll = new iScroll('share_house_content', {
					checkDOMChanges: true,
					hScrollbar: false,
					vScrollbar: false
				});
			}
			if(!ShareHouse.picsScroll) {
				ShareHouse.picsScroll = new iScroll('pic_detail', {
					checkDOMChanges: true,
					hScrollbar: false,
					vScrollbar: false,
					vScroll: false
				});
			}
			if(!ShareHouse.vrScroll) {
				ShareHouse.vrScroll = new iScroll('vr_detail', {
					checkDOMChanges: true,
					hScrollbar: false,
					vScrollbar: false,
					vScroll: false
				});
			}

			if(!ShareHouse.imgshowScroll) {
				ShareHouse.imgshowScroll = new iScroll('imgshowdiv', {
					checkDOMChanges: true,
					hScrollbar: false,
					vScrollbar: false,
					vScroll: false
				});
			}
			if(!ShareHouse.showScroll) {
				ShareHouse.showScroll = new iScroll('pic_show', {
					checkDOMChanges: true,
					hScrollbar: false,
					vScrollbar: false
				});
			}
		},
		initSwiper: function() {
			if(!TabScrollTop.tabsSwiper) {
				TabScrollTop.tabsSwiper = $('#swiper-container-top').swiper({
					pagination: '#pagination-top',
					createPagination: true,
					onlyExternal: ShareHouse.isExternal,
					speed: 1000,
					autoplay: ShareHouse.topSpeed,
					loop: true,
					onSlideChangeStart: function() {},
					onSlideChangeEnd: function() {
						TabScrollTop.tabsSwiper.startAutoplay();
					}
				});
				TabScrollTop.bindEvent();
			}
		},
		init: function() {

			//员工登录的时候不显示 负责人一栏目
			if(window.localStorage.getItem("loginType") == "employee") {
				$('#bespeak_button').hide();
				if(localStorage.getItem("isLogined") == 1) {
					$('#content_introduce').show();
				} else {
					$('#content_introduce').hide();
				}
			} else {
				$('#content_introduce').hide();
			}
			if(!!ShareHouse.request('vheader')) {
				$('#showFooterMask').hide();
			}
			if(ShareHouse.request("id") != undefined && ShareHouse.request("id") != null) {
				ShareHouse.topicId = ShareHouse.request("id");
				ShareHouse.from = shareHouse_storage.getItem("from");
			} else {
				ShareHouse.topicId = shareHouse_storage.getItem("houseId");
				ShareHouse.from = shareHouse_storage.getItem("from");
			}
			ShareHouse.getInfo();
			$("#pic_show").bind("click", function() {
				ShareHouse.hidePic();
			});
			$("#detail_nav_introduce").bind("click", function() {
				if($("#detail_nav_introduce img").attr("src") == "css/images/detail_nav_bottom.png") {
					$("#detail_introduce").css("height", $("#detail_introduce_info").height() + 20 + "px");
					$("#detail_nav_introduce img").attr("src", "css/images/detail_nav_top.png");
				} else {
					$("#detail_introduce").css("height", "60px");
					$("#detail_nav_introduce img").attr("src", "css/images/detail_nav_bottom.png");
				}
			});
			$("#detail_nav_traffic").bind("click", function() {
				if($("#detail_nav_traffic img").attr("src") == "css/images/detail_nav_bottom.png") {
					$("#detail_traffic").css("height", $("#detail_traffic_info").height() + 20 + "px");
					$("#detail_nav_traffic img").attr("src", "css/images/detail_nav_top.png");
				} else {
					$("#detail_traffic").css("height", "60px");
					$("#detail_nav_traffic img").attr("src", "css/images/detail_nav_bottom.png");
				}
			});
			$("#recommend_button").bind("click", function() {
				ShareHouse.goRecommend('1');
			});
			$("#bespeak_button").bind("click", function() {
				ShareHouse.goRecommend('2');
			});
			$("#shoprent_button").bind("click", function() {
				ShareHouse.goRecommend('3');
			});
			$("#imgUrl_map").bind("click", function() {
				//								$("#allmap").show();
				//								$("#back_map").show();
				//								ShareHouse.buildMap();
				window.location.href = "showMap.html"
			});
			$("#back_icon").bind("click", function() {
				$("#allmap").hide();
				$("#back_map").hide();
			});
			//点击收藏
			$('#collect_button').bind("click", function() {
				if(localStorage.getItem('isLogined') == 1) {
					if(!!$(this).hasClass('on')) {
						ShareHouse.delCollect();
					} else {
						ShareHouse.doCollect();
					}
				} else {
					$("#select_div0").show();
					$("#select_mask_active").show();
				}
			});
			$("#shop_merchantsbody .updownmenu").bind("click", function() {
				if($(this).find("img").attr("src") == "resource/css/images/sharehouse/arrowUp@2x.png") {
					$(this).find("img").attr("src", "resource/css/images/sharehouse/arrowDown@2x.png");
					$("#shop_merchants").css("height", "30px");
				} else {
					$(this).find("img").attr("src", "resource/css/images/sharehouse/arrowUp@2x.png");
					$("#shop_merchants").css("height", "auto");
				}
			});
			$("#detail_introducebody .updownmenu").bind("click", function() {
				if($(this).find("img").attr("src") == "resource/css/images/sharehouse/arrowUp@2x.png") {
					$(this).find("img").attr("src", "resource/css/images/sharehouse/arrowDown@2x.png");
					$("#detail_introduce").css("height", "30px");
				} else {
					$(this).find("img").attr("src", "resource/css/images/sharehouse/arrowUp@2x.png");
					$("#detail_introduce").css("height", "auto");
				}
			});
			$("#content_traffic .updownmenu").bind("click", function() {
				if($(this).find("img").attr("src") == "resource/css/images/sharehouse/arrowUp@2x.png") {
					$(this).find("img").attr("src", "resource/css/images/sharehouse/arrowDown@2x.png");
					$("#detail_traffic_info").css("height", "30px");

				} else {
					$(this).find("img").attr("src", "resource/css/images/sharehouse/arrowUp@2x.png");
					$("#detail_traffic_info").css("height", "auto");
				}
			});
			ShareHouse.queryCollect();

		},
		//前往登录
		goLogin: function() {
			window.location.href = "login.html";
		},
		//关闭弹窗
		closeTip: function() {
			$("#select_div0").hide();
			$("#select_mask_active").hide();
		},
		//提示信息
		showMessges: function(messges) {
			$("#shareHouse_error_word").html(messges);
			$("#shareHouse_error").css("visibility", "visible");
			setTimeout('$("#shareHouse_error").css("visibility", "hidden")', 3000);
		},
		//判断是否收藏
		queryCollect: function(id) {
			$.M.post({
				method: '/rest/building/isCollect',
				params: {
					"brokerId": localStorage.getItem('userId'),
					"relationId": Common.getQueryString("id"),
					"sourceType": "0"
				},
				success: function(data) {
					if(JSON.parse(data).result) {

						if(JSON.parse(data).objValue) {
							$('#collect_button').addClass('on');
						} else {
							$('#collect_button').removeClass('on');
						}
					}
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {}
			}, "0");
		},
		request: function(strParame) {
			var args = new Object();
			var query = location.href;
			var newQuery = query.substring(query.lastIndexOf('?') + 1);
			var pairs = newQuery.split("&"); // Break at ampersand
			for(var i = 0; i < pairs.length; i++) {
				var pos = pairs[i].indexOf('=');
				if(pos == -1)
					continue;
				var argname = pairs[i].substring(0, pos);
				var value = pairs[i].substring(pos + 1);
				value = decodeURIComponent(value);
				args[argname] = value;
			}
			return args[strParame];
		},
		goRecommend: function(type) {
			shareHouse_storage.setItem("houseName", ShareHouse.houseName);
			shareHouse_storage.setItem("houseId", ShareHouse.houseId);
			shareHouse_storage.setItem("areaId", ShareHouse.areaId);
			shareHouse_storage.setItem("areaName", ShareHouse.areaName);
			shareHouse_storage.setItem("isNationalMaketing", ShareHouse.isNationalMaketing);
			shareHouse_storage.setItem("isHaveReward", ShareHouse.isHaveReward);
			shareHouse_storage.setItem("isAcceptRecommend", ShareHouse.isAcceptRecommend);
			shareHouse_storage.setItem("Menutype", type);

			var isLogined = shareHouse_storage.getItem("isLogined");
			if(isLogined == null || isLogined == "0") {
				window.location.href = 'login.html?from=' + shareHouse_storage.getItem("from");
				return;
			}
			var needidcard = 0;
			if(ShareHouse.needIdCard != null && ShareHouse.needIdCard == '1') {
				needidcard = 1;
			}
			window.location.href = "recommendPage.html?CityId=" + shareHouse_storage.getItem("cityId") + "&intetLoup=" + ShareHouse.houseName + "&intentId=" + ShareHouse.houseId + "&type=2&isNationalMaketing=" + ShareHouse.isNationalMaketing + "&isHaveReward=" + ShareHouse.isHaveReward + "&isAcceptRecommend=" + ShareHouse.isAcceptRecommend + "&isNeedIdCard=" + needidcard;
		},
		showPics: function(imgStrs, imgNum) {
			if($.M.isAndroid) {
				android.showPic(imgStrs, imgNum);
			} else if($.M.isIos) {
				webView.callNative('showPic:index:', imgStrs, imgNum);
			}
		},
		//收藏
		doCollect: function(id) {
			$.M.post({
				method: '/rest/building/addCollect',
				params: {
					"brokerId": localStorage.getItem('userId'),
					"relationId": Common.getQueryString("id"),
					"isLike": 0,
					"sourceType": "0",
				},
				success: function(data) {
					if(JSON.parse(data).result) {
						$('#collect_button').addClass('on');
						ShareHouse.showMessges("已收藏成功，前往我的收藏查看");
					}

				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					ShareHouse.showMessges(data.value);
				}
			}, "0");

		},
		//取消收藏
		delCollect: function() {
			$.M.post({
				method: '/rest/building/delCollect',
				params: {
					"brokerId": localStorage.getItem('userId'),
					"isLike": 1,
					"sourceType": "0",
					"relationId": Common.getQueryString("id"),
				},
				success: function(data) {
					if(JSON.parse(data)) {
						$('#collect_button').removeClass('on');
						ShareHouse.showMessges("已取消收藏！");
					}
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					ShareHouse.showMessges(data.value);
				}
			}, "0");

		},
		//		buildMap: function() {
		//			var mymap = new BMap.Map("allmap"); // 创建Map实例
		//			var point = new BMap.Point(ShareHouse.address_x, ShareHouse.address_y);
		//			mymap.centerAndZoom(point, 13); // 初始化地图,设置中心点坐标和地图级别
		//			//mymap.addControl(new BMap.ZoomControl());
		//			var marker1 = new BMap.Marker(point); //创建标注
		//			mymap.addOverlay(marker1); // 将标注添加到地图中
		//			//创建信息窗口
		//
		//			var opts = {
		//				width: 200, // 信息窗口宽度
		//				//height: 100, // 信息窗口高度
		//				title: ShareHouse.houseName, // 信息窗口标题
		//				enableMessage: true, //设置允许信息窗发送短息
		//				message: ""
		//			}
		//
		//			var infoWindow1 = new BMap.InfoWindow(ShareHouse.address, opts);
		//			marker1.addEventListener("click", function() {
		//				this.openInfoWindow(infoWindow1);
		//			});
		//		},
		getInfo: function() { //日志详情请求的接口

			var params = {
				"id": ShareHouse.topicId, //"fa35dcd0755b4c9a94ed553af08c1aab"
				"from": ShareHouse.from,
			};

			var fromFlag = shareHouse_storage.getItem("from");
			if(fromFlag) {
				$.extend(params, {
					'fromApp': fromFlag,
					'remoteIp': $.cookie("H5ip")
				});
			} else {
				$.extend(params, {
					'fromApp': '2',
					'openId': $.cookie("openid")
				});
			}

			ShareHouse.showMask("c", "正在加载...");
			if($.M.openAjax) {
				$.M.post({
					method: "/rest/building/queryBuildingInfo",
					params: params,
					success: function(data) {
						ShareHouse.hideMask("c", "正在加载...");
						data = eval('(' + data + ')');
						var info;
						if(data.objValue != null && data.objValue != undefined) {
							info = data.objValue;
						}
						if(Common.getQueryString('from') == "IOS" && document.body.clientHeight > 500) {
							$("#info_content").css("margin-bottom", "44px")
						}
						//$("#content_text").html(info.content.replace(/\n/g, "<br/>"));
						if(Common.getQueryString('from') == "IOS" || Common.getQueryString('from') == "Android" || Common.getQueryString('from') == "APP" || Common.getQueryString('from') == "App") {

							window.location.href = 'javascrript:shareInfo&' + info.salePoint + '&' + info.id + '&' + info.picsrc + '&' + info.name

						}
						ShareHouse.houseName = info.name;
						ShareHouse.houseId = info.id;
						ShareHouse.areaName = info.area;
						ShareHouse.areaId = info.areaId;
						ShareHouse.isNationalMaketing = info.isNationalMaketing;
						ShareHouse.isHaveReward = info.isHaveReward;
						ShareHouse.isAcceptRecommend = info.isAcceptRecommend;
						ShareHouse.needIdCard = info.isIdCard;

						var hotline = '<a href="tel:' + info.hotline + '">' + info.hotline + '</a>';
						$("#hotline").html(hotline);
						$("#attentionHeat").html(info.recommendedNum);
						$(".callto").attr("href", "tel:" + hotline);

						var $body = $('body');
						$("#block").html(info.name);
						$(".nameprice .infodiv .grey").html(info.salePoint);
						var ua = window.navigator.userAgent.toLowerCase();
						if(ua.match(/MicroMessenger/i) == 'micromessenger') {
							// hack在微信等webview中无法修改document.title的情况
							var $iframe = $('<iframe src="/favicon.ico"></iframe>').on('load', function() {
								setTimeout(function() {
									$iframe.off('load').remove()
								}, 0)
							}).appendTo($body)
						}

						var lxrlis = [];
						$.each(info.principalList, function(index, obj) {
							lxrlis.push("<li><span>" + obj.name + "</span>");
							lxrlis.push("<span>" + obj.phone + "</span></li>");
						});
						$(".fzr_info").html(lxrlis.join(""));

						//						$("#buildingName").html(info.name);
						//						$("#areaName").html("[" + info.area + "]");
						$("#salePoint span").html(info.salePoint);
						$("#address span").html(info.address);
						var htmlprice = "";
						if(info.pricePerSuiteScope != "") {
							//$(".nameprice .infodiv .topdiv .orange").html(info.pricePerSuiteScope + "元/m²");//总价
							htmlprice = '<img src="resource/css/images/sharehouse/icon_zongjia@2x.png"><span id="pricespan">' + info.pricePerSuiteScope + '元/m²</span>'
						} else if(info.price != "") {
							htmlprice = '<img src="resource/css/images/sharehouse/icon_junjia-hot@2x.png"><span id="pricespan">' + info.price + '元/m²</span>'
							//$(".nameprice .infodiv .topdiv .orange").html(info.price + "元/m²");//均价
						} else {
							htmlprice = '<img src="resource/css/images/sharehouse/icon_qijia@2x.png"><span id="pricespan">' + info.minPrice + '元/m²</span>'
							//$(".nameprice .infodiv .topdiv .orange").html(info.minPrice + "元/m²");//起价
						}
						$(".phone_div .price").html(htmlprice);
						$(".bottomdiv .orange ex").html(info.ratio);
						$("#bespeakNum").html(info.bespeakNum);
						$("#recommendedNum").html(info.recommendedNum);

						$("#discountDetails span").html(info.discount);
						$("#discountTime span").html(info.discountEndTime);

						$("#detail_address span").html(info.address);
						$("#back_map a").attr("href", 'daohang:{"latitude":' + info.addressY + ',"locationName":"' + info.address + '","longitude":' + info.addressX + '}')
						if(info.buildingRentInfoPO != null && info.buildingRentInfoPO != undefined && info.buildingRentInfoPO != "") {
							$("#shop_merchantsbody").show();
							$("#preferential").html(info.buildingRentInfoPO.rentDiscount);
							$("#merchants_phone").append('<a href="tel:' + info.buildingRentInfoPO.rentHotline + '">' + info.buildingRentInfoPO.rentHotline + '</a>');
							$("#business").html(info.buildingRentInfoPO.openBusiness);
							$("#opening_business").html(info.buildingRentInfoPO.willOpenBusiness);
							$("#business_planning").html(info.buildingRentInfoPO.rentPlan);
							$("#area_section").html(info.buildingRentInfoPO.rentArea);
							$("#delivery_time").html(info.buildingRentInfoPO.rentDeliveryTime);
						} else {
							$("#shop_merchantsbody").hide();
						}
						$('#isAcceptRecommend').html(info.isAcceptRecommend == 1 ? "是" : "否");
						$('#isHavaAword').html(info.isHaveReward == 1 ? "是" : "否");
						$("#saleStartAt").html(info.openingDate);
						$("#characteristic").html(info.characteristic);
						$("#buildingType").html(info.buildingType);
						$("#fitmentLevelName").html(info.fitmentLevelName);
						$("#buildingArea").html(info.buildingArea);
						$("#propertyRightsName").html(info.propertyRightsName);
						$("#greeningRate").html(info.greeningRate);
						$("#propertyCompany").html(info.propertyCompany);
						$("#deliveryTime").html(info.deliveryTime);
						$(".phone_div .callto").attr("href", "tel:" + info.hotline);
						ShareHouse.address_x = info.addressX;
						ShareHouse.address_y = info.addressY;
						ShareHouse.address = info.address;
						localStorage.setItem("housename", info.name);
						localStorage.setItem("address", info.address);
						localStorage.setItem("address_x", info.addressX);
						localStorage.setItem("address_y", info.addressY);
						if(Common.getQueryString("isChangeRang") != 0) {
							localStorage.setItem("addressRang_x", info.addressX);
							localStorage.setItem("addressRang_y", info.addressY);
						}
						var imgUrl = 'http://api.map.baidu.com/staticimage?center=' + ShareHouse.address_x + ',' + ShareHouse.address_y + '&width=900&height=300&zoom=12&scale=1&markers=' + (ShareHouse.address_x + ',' + ShareHouse.address_y);
						$("#imgUrl_map").attr("src", imgUrl);
						/*if($("#detail_introduce_info").height <= 60) {
							$("#detail_nav_introduce img").hide();
						}*/

						$("#detail_traffic_info").html(info.trafficCfg.replace(/ /g, "&nbsp;").replace(/\n/g, "<br/>"));

						var houseImg = '';
						var houseVrImg = '';
						var banners = $(".swiper-slide");

						//判断是否是一张图，一张不滚动
						var topImgIsFrist = true;
						$.each(info.items, function(i, item) {
							if(item.sourceType == "2") {
								if(topImgIsFrist) {
									$(banners[0]).children().attr("src", item.attach.uname);
									$(banners[1]).children().attr("src", item.attach.uname);
									$(banners[2]).children().attr("src", item.attach.uname);
									ShareHouse.topSpeed = 0;
									ShareHouse.isExternal = true;
									topImgIsFrist = false;
								} else {
									ShareHouse.topSpeed = 3000;
									ShareHouse.isExternal = false;
								}
							}
						});
						ShareHouse.initSwiper(); //渲染swiper

						var imageIndex = 0;
						var topimgdiv = "";
						var topimg = 0;
						var topImgIsFrist2 = true;
						$.each(info.items, function(i, item) {
							if(item.sourceType == "2") {
								var imgPath = "";
								if(item.attach != null && item.attach.uname != undefined && item.attach.uname != null) {
									imgPath = item.attach.uname;
								}
								if(topImgIsFrist2 == false) {
									TabScrollTop.tabsSwiper.appendSlide('<img src="' + imgPath + '" />', 'swiper-slide');
								} else {
									topImgIsFrist2 = false;
								}
							} else if(item.sourceType == "3") {
								imageIndex++;
								var imgPath = "";
								if(item.attach != null && item.attach.uname != undefined && item.attach.uname != null) {
									imgPath = item.attach.uname;
								}
								houseImg += '<div class="img_div" onclick="ShareHouse.TopshowPic(this);" imageId="' + item.id + '" imageIndex="' + imageIndex + '">' + '<img src="' + imgPath + '">' + '<div class="img_text">' + item.houseType + '&nbsp;&nbsp;' + item.houseTypeArea + '</div>' + '<div class="img_title">' + item.houseTypeDesc + '</div></div>';
							} else if(item.sourceType == "4") {
								topimg++;
								var imgPath = "";
								if(item.attach != null && item.attach.uname != undefined && item.attach.uname != null) {
									imgPath = item.attach.uname;
								}
								var width = ($(window).width() - 50) / 3;
								topimgdiv += '<div class="imginfo" style="width:' + width + 'px;" onclick="ShareHouse.TopshowPic(this)" imageId="' + item.id + '" topimg="' + topimg + '">'
								topimgdiv += '<div class="imgpic">'
								topimgdiv += '<img class="img_1" src="' + imgPath + '">'
								topimgdiv += '</div>'
								topimgdiv += '<div class="greytext">' + item.houseType + '</div>'
								topimgdiv += '</div>'
							} else if(item.sourceType == "11") {
								$("#content_vr").show();
								var imgPath = "";
								if(item.attach != null && item.attach.uname != undefined && item.attach.uname != null) {
									imgPath = item.attach.uname;
								}
								houseVrImg += '<a class="img_div" href=' + item.houseVRUrl + ";return false" + ' imageId="' + item.id + '" imageIndex="' + imageIndex + '" >' + '<img src="' + imgPath + '">' + '<div class="img_title">' + item.houseType + '</div></a>';
							}
						});

						ShareHouse.setHeight();

						//setTimeout("ShareHouse.resetImg()", 20);
						$("#vr_scroll_info").html(houseVrImg);

						houseImg += '<div class="img_div"></div>';
						$("#pic_scroll_info").html(houseImg);

						if(topimgdiv != "" && topimgdiv != null && topimgdiv != undefined) {
							$(".imgshow").css("display", "block");
							$("#topimg_scroll_div").html(topimgdiv);
						} else {
							$(".imgshow").css("display", "none");
						}

						//户型图宽度自适应
						var wWidth = $(window).width();
						$(".img_div").css("width", wWidth * 0.27 + "px");
						$(".img_div").css("height", wWidth * 0.27 + 30 + "px");
						$(".img_div img").css("width", wWidth * 0.27 + "px");
						$(".img_div img").css("height", wWidth * 0.27 + "px");

					},
					error: function(XMLHttpRequest, textStatus, errorThrown) {
						ShareHouse.hideMask("c", "正在加载...");
					}
				}, "0");
			}
		},
		showPic: function(imgObj) {
			var topicId = shareHouse_storage.getItem("houseId");
			var imageIndex = $(imgObj).attr("imageIndex");
			shareHouse_storage.setItem("topicId", topicId);
			shareHouse_storage.setItem("imageIndex", imageIndex);
			window.location.href = "showPic.html";
			shareHouse_storage.setItem("openimgtype", "户型图");
		},
		TopshowPic: function(obj) {
			var topimg = $(obj).attr("topimg");
			var Itemid = $(obj).attr("imageId");
			shareHouse_storage.setItem("topicItemId", Itemid);
			shareHouse_storage.setItem("topimg", topimg);
			window.location.href = "showPic.html";
			shareHouse_storage.setItem("openimgtype", "实景图");
		},
		oldshowPic: function(picId) {
			ShareHouse.showMask("c", "正在加载...");
			if($.M.openAjax) {
				$.M.post({
					method: "/rest/building/queryBuildingHouseType",
					params: {
						"itemId": picId //235ad1be6c00445883ddbcae2f7ebf7e
					},
					success: function(data) {
						ShareHouse.hideMask("c", "正在加载...");
						data = eval('(' + data + ')');
						var info;
						var ShowImg = '';
						if(data.result) {
							if(data.objValue != null && data.objValue != undefined) {
								info = data.objValue;
							}
							$.each(info, function(i, item) {
								if(item.attach != null && item.attach != undefined) {
									ShowImg += '<div class="pic_div"><img src="' + item.attach.uname + '" /></div>';
								}
							});

							$("#pic_show_sroll").html(ShowImg);
							$("#pic_show").show();
						}
					},
					error: function(XMLHttpRequest, textStatus, errorThrown) {
						ShareHouse.hideMask("c", "正在加载...");
					}
				}, "0");
			}

		},
		hidePic: function() {
			$("#pic_show").hide();
		},
		setHeight: function() {
			var wWidth = $(window).width();
			var imgHeight = $("#swiper-container-top .swiper-slide img").height();
			// 284×964
			imgHeight = wWidth * 81 / 144;
			$("#swiper-container-top .swiper-wrapper").css("height", imgHeight + "px");
			$("#swiper-container-top .swiper-wrapper .swiper-slide").css("height", imgHeight + "px");
			$("#swiper-container-top .swiper-wrapper .swiper-slide").css("width", wWidth + "px");
			//$("#swiper-container-top .swiper-slide img").css("max-height", imgHeight + "px");
			$("#swiper-container-top .swiper-slide img").css("max-width", wWidth + "px");
		},
		resetImg: function() {
			var imgList = $("#swiper-container-top .swiper-slide img");
			var imgDivList = $("#swiper-container-top .swiper-wrapper .swiper-slide");
			for(var i = 0; i < imgList.length; i++) {
				var imgObj = $(imgList[i]);
				var imgDivObj = $(imgDivList[i]);
				if(imgObj.height() > 0) {
					var ptop = (imgDivObj.height() - imgObj.height()) / 2;
					imgObj.css("margin-top", (ptop + "px"));
				}
			}
		}
	};

	/*var TabScroll = {
		tabsSwiper : null,
		bindEvent : function() {
			$(window).resize(function() {
				//ShareHouse.setHeight();
			});
		}
	}*/
	var TabScrollTop = {
		tabsSwiper: null,
		bindEvent: function() {
			$(window).resize(function() {
				//ShareHouse.setHeight();
				setTimeout("ShareHouse.setHeight()", 20);
			});
		}
	}
	$(document).delegate("#share_house_page", "pageshow", function(e, ui) {
		try {
			ShareHouse.initScroll();
			ShareHouse.init();

		} catch(e) {
		}

	});
});